key-binding which-key-replacement-alist
'which-key--replacement-test))))
(cond ((null res) key-binding)
+ ((functionp res) (funcall res key-binding))
((consp res)
(cons
(cond ((and (car res) (car which-key--last-replace-key))
(cdr which-key--last-replace-key)
(cdr res) (cdr key-binding) t))
((cdr res) (cdr res))
- (t (cdr key-binding)))))
- ((functionp res) (funcall res key-binding)))))
+ (t (cdr key-binding))))))))
(defsubst which-key--current-key-list (&optional key-str)
(append (listify-key-sequence which-key--current-prefix)
(let ((sep-w-face
(propertize which-key-separator 'face 'which-key-separator-face))
(local-map (current-local-map)))
- (mapcar
- (lambda (key-binding)
- (let* ((key (car key-binding))
- (orig-desc (cdr key-binding))
- (group (which-key--group-p orig-desc))
- (keys (which-key--current-key-string key))
- (local (eq (which-key--safe-lookup-key local-map (kbd keys))
- (intern orig-desc)))
- (hl-face (which-key--highlight-face orig-desc))
- (key-binding (which-key--maybe-replace (cons keys orig-desc))))
- (list (which-key--propertize-key
- (car (last (split-string (car key-binding) " "))))
- sep-w-face
- (which-key--propertize-description
- (cdr key-binding) group local hl-face orig-desc))))
- unformatted)))
+ (delq
+ nil
+ (mapcar
+ (lambda (key-binding)
+ (let* ((key (car key-binding))
+ (orig-desc (cdr key-binding))
+ (group (which-key--group-p orig-desc))
+ (keys (which-key--current-key-string key))
+ (local (eq (which-key--safe-lookup-key local-map (kbd keys))
+ (intern orig-desc)))
+ (hl-face (which-key--highlight-face orig-desc))
+ (key-binding (which-key--maybe-replace (cons keys orig-desc))))
+ (when (consp key-binding)
+ (list (which-key--propertize-key
+ (car (last (split-string (car key-binding) " "))))
+ sep-w-face
+ (which-key--propertize-description
+ (cdr key-binding) group local hl-face orig-desc)))))
+ unformatted))))
(defun which-key--get-keymap-bindings (keymap &optional filter)
"Retrieve top-level bindings from KEYMAP."